/*
 * @Descripttion: contextProvider入口
 * @Author: 毕怀智
 * @Date: 2021-11-17 19:00:51
 * @Function: 用于提供全局状态管理
 */
import React, { ReactNode } from "react";
import { QueryClient, QueryClientProvider } from "react-query";

import { AuthProvider } from "context/AuthContext";

export const AppProviders = ({ children }: { children: ReactNode }) => {
  //  减少react-query请求多次接口
  // const queryClient = new QueryClient();
  const queryClient = new QueryClient({
    defaultOptions: {
      queries: {
        refetchOnWindowFocus: false,
      },
    },
  })

  return (
    <QueryClientProvider client={queryClient}>
      <AuthProvider>{children}</AuthProvider>
    </QueryClientProvider>
  );
};
